from PyQt5 import QtWidgets
from PyQt5.QtGui import QFontDatabase, QFont
from PyQt5.QtWidgets import  QApplication
import sys

import fznChatUtil
from login_form import LoginWidget

if __name__ == "__main__":

    app = QtWidgets.QApplication(sys.argv)

    # 设置字体
    font_db = QFontDatabase()
    font_db.addApplicationFont(":/font/resources/msyh.ttf")
    QApplication.setFont(QFont("Microsoft YaHei"))

    # 网络发送、接收信息都通过这一个实例
    network = fznChatUtil.FznChatNetWork(app, server="serverAddress", port="serverPort", logger=None)

    # 创建登录页面并显示
    Form = LoginWidget(main_form=None, database="database", server="serverAddress", port="serverPort", network=network,
                       log=None)
    Form.setupUi()
    Form.show()
    Form.auto_login()

    sys.exit(app.exec_())
